<!DOCTYPE HTML SYSTEM>
<html>

<head>
<title>FNET Statistics</title>
    <style type="text/css">
    <!--
    @import"fnet.css";
    -->
    </style>
	<script type="text/javascript">
		var fnetDataReceived = 0;
		function fnetXMLHttpRequest(){
			var xmlHTTP = false;
			if (window.ActiveXObject)
				xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
			else if (window.XMLHttpRequest)
				xmlHTTP = new XMLHttpRequest();
			if (!xmlHTTP)
				alert("Cannot create an XMLHTTP instance!");
			return xmlHTTP;
		}
		function fnetXMLHttpRequest(){
			var xmlHTTP = false;
			if (window.ActiveXObject)
				xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");
			else if (window.XMLHttpRequest)
				xmlHTTP = new XMLHttpRequest();
			if (!xmlHTTP)
				alert("Cannot create an XMLHTTP instance!");
			return xmlHTTP;
		}
		function fnetRequest(){
			if (!fnetDataReceived){
		        var xmlHTTP = fnetXMLHttpRequest();
				fnetDataReceived = 1;
				if( xmlHTTP != null){
					xmlHTTP.onreadystatechange = function(){
				  		if (xmlHTTP.readyState == 4){
							if (xmlHTTP.status == 200)
									fnetHandler(xmlHTTP.responseText);
				  			fnetDataReceived = 0;
			  			}
					};
					xmlHTTP.open("GET", "stdata.cgi", true);
					xmlHTTP.setRequestHeader("If-Modified-Since", document.lastModified);
					xmlHTTP.send(null);
				}
			}
		}
		function fnetHandler(data){
			var statistics = eval(data);
			document.getElementById("rtc").innerHTML = statistics.time;
			document.getElementById("tx").innerHTML = statistics.tx;
			document.getElementById("rx").innerHTML = statistics.rx;
		}
	    window.setInterval("fnetRequest()", 1000);
	</script>
</head>
<body>
	<h2>FNET Statistics</h2>
	<table width = "300">
	<tr>
		<th>Parameter</th>
		<th>Value</th>
	</tr>
	<tr>
		<td class="fnet_td_grey">Work time</td>
		<td align="right"><strong><div id="rtc">0</div></strong></td>
	</tr>
	<tr>
		<td class="fnet_td_grey">Tx packet count</td>
		<td align="right"><strong><div id="tx">0</div></strong></td>
	</tr>
	<tr>
		<td class="fnet_td_grey">Rx packet count</td>
		<td align="right"><strong><div id="rx">0</div></strong></td>
	</tr>
	</table>
	<br/>
	<br/>
	<i>NOTE: This page gets the data from the server periodically with help of AJAX. <br/> It is used JavaScript, CGI and JSON data format.</i>
</body>
</html>		
